package com.huhu.entity;

import com.huhu.common.util.DataUt;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 
 * @version 1.0 2016-09-15
 */
public class Role {
    private Integer roleId;

    private String roleName;
    //一个角色对应多个用户
    private List<User> userList;
    //一个角色对应多个仅限
    private List<Permission> permissionList;

    //获取角色对应的所有权限的名称
    public List<String> getPermissionsName() {
        List<String> perNameList = new ArrayList<String>();
        List<Permission> permissionList = getPermissionList();

        if (DataUt.isNotEmpty(permissionList)) {
            for (Permission per : permissionList) {
                perNameList.add(per.getPermissionName());
            }
        }
        return perNameList;
    }


    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

    public List<Permission> getPermissionList() {
        return permissionList;
    }

    public void setPermissionList(List<Permission> permissionList) {
        this.permissionList = permissionList;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }
}